﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="ArticleAttachments" name="Article File Attachment Configuration">
	<Dependencies>
		<Dependency type="feature">ArticlesFeature.xml</Dependency>
	</Dependencies>

	<BusinessRules>
		<BusinessRule name="getArticleAttachmentGroups" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getArticleAttachmentGroupsWithFiles" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateArticleAttachmentGroup" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteArticleAttachmentGroup" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getAllCompanyArticlesForFileGroup" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getArticleAttachmentGroupFiles" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="addArticleAttachmentGroupFile" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateArticleAttachmentGroupFile" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteArticleAttachmentGroupFile" security="disabled">
			<Option value="$ArticlesRemoteTier$">
				<RemoteRule url="$ArticlesRemoteTier$" />
				<LocalClass name="Articles.FileSysArticleAttachBizRules,ScsCore" />
			</Option>
		</BusinessRule>
	</BusinessRules>

	<BusinessObjects>
		<BusinessObject type="ArticleFileAttachment" key="id">
			<Field name="id" type="Guid" />
			<Field name="fileGroupId" type="Guid" />
			<Field name="fileCacheName" type="String" />
			<Field name="filePathName" type="String" />
			<Field name="fileImageUrl" type="String" />
			<Field name="fileUrl" type="String" />
			<Field name="authorized" type="Boolean"/>
			<Field name="size" type="String" />
			<Field name="articleId" type="Guid" />
			<Field name="description" type="String" />
			<Method name="displayName" language="jscript.NET">
				<![CDATA[
				var y = self.getItem("description");
				if(!Cmn.IsEmpty(y))
					return y;
				var x = self.getItem("filePathName");
				return x.Substring(x.LastIndexOf(System.IO.Path.DirectorySeparatorChar) +1);
			]]>
			</Method>
			<Method name="gridImage" language="jscript.NET">
				<![CDATA[
				if(Cmn.IsEmpty(self.getItem("fileImageUrl")))
					return "";
				return "#&lt;#img src='" + self.getItem("fileImageUrl").Replace("FsSize", "FsSmallSize") + "' /#&gt;#";
			]]>
			</Method>
		</BusinessObject>

		<BusinessObject type="ArticleAttachmentGroup" key="id">
			<Field name="id" type="Guid" />
			<Field name="articleId" type="Guid" />
			<Field name="authorizedArticleId" type="Guid"><NULL/></Field>
			<Field name="unauthorizedArticleId" type="Guid"><NULL/></Field>
			<Field name="files" type="List(ArticleFileAttachment)" />
			<Field name="displayArticle" type="Article" />
		</BusinessObject>

	</BusinessObjects>

	<ClassFactory id="BizProcs">
		<Class type="Articles.Gui.ArticleAttachmentGroupBizProc,ScsCore" name="articleAttachmentGroups"/>
		<Class type="Articles.Gui.ArticleAttachmentBizProc,ScsCore" name="articleAttachments"/>
	</ClassFactory>
</Feature>
